package com.aspose.cells;

class zzj extends zyr {
   private Object a;
   private zaoe b;
   private int c = 0;
   private int d;
   private zaar e;

   public zzj(int var1, Name var2, int var3) {
      this.d = var1;
      this.a = var2;
      this.b = var2.b;
      if (var3 > -1) {
         this.c = -var3 - 1;
      }

   }

   public zzj(int var1, zuk var2, int var3) {
      this.d = var1;
      this.a = var2;
      this.b = var2.a;
      this.c = var3 + 1;
   }

   private zzj() {
   }

   public zagu i() {
      zzj var1 = new zzj();
      var1.d = this.d;
      var1.a = this.a;
      var1.b = this.b;
      if (this.e != null) {
         var1.e = this.e.a();
      }

      return var1;
   }

   public void j() {
      if (this.e != null) {
         this.e.b();
      }

   }

   public boolean k() {
      return this.c > 0;
   }

   public zaoe l() {
      return this.b;
   }

   public int b() {
      return 8;
   }

   public Object c() {
      return this.a;
   }

   public Object b(zaay var1) {
      zagu var2 = this.d(var1);
      return var2 == this ? null : var2.b(var1);
   }

   public int d() {
      return this.d;
   }

   public int a(zaay var1) {
      zagu var2 = this.b.a;
      if (var2 != null) {
         return var2.a(var1);
      } else {
         var2 = this.n(var1);
         return var2.a(var1);
      }
   }

   public boolean c(zaay var1) {
      return this.n(var1).c(var1);
   }

   public int b(zaay var1, boolean var2) {
      if (this.b.c) {
         return 0;
      } else {
         zagu var3 = this.b.a;
         if (var3 != null) {
            return var3.b(var1, var2);
         } else {
            var3 = this.n(var1);
            return var3.b(var1, var2);
         }
      }
   }

   public boolean a(zaay var1, int var2, int var3, boolean var4) {
      if (this.b.c) {
         if (this.e != null) {
            this.e.a = null;
         }

         return true;
      } else {
         zagu var5 = this.b.a;
         if (var5 != null) {
            if (var5.a(var1, var2, var3, var4)) {
               if (this.e != null) {
                  this.e.a(var1, var2, var3, var4);
               }

               return true;
            } else {
               return false;
            }
         } else {
            if (this.b.a != null) {
               this.b.a.a(var1, var2, var3, var4);
            }

            return true;
         }
      }
   }

   public boolean c(zaay var1, boolean var2) {
      zagu var3 = this.b.a;
      if (var3 != null) {
         return var3.c(var1, var2);
      } else {
         var3 = this.n(var1);
         return var3.c(var1, var2);
      }
   }

   public boolean f() {
      return false;
   }

   public byte a() {
      return (byte)(this.c != 0 ? 57 : 35);
   }

   public boolean g() {
      return true;
   }

   public void a(boolean var1) {
      if (this.e == null) {
         this.e = new zaar();
      }

   }

   public zaar h() {
      return this.e;
   }

   public void a(zaar var1) {
      this.e = var1;
   }

   public zagu e(zaay var1) {
      if (this.e != null && this.e.a != null) {
         return this.e.a;
      } else {
         Object var2 = this.a(this.d(var1), var1);
         if (var2 != this) {
            if (this.b.b) {
               var2 = zzc.a;
            } else {
               var1.p.a(this.b);
               var2 = ((zagu)var2).e(var1);
               var1.p.d();
            }
         }

         if (this.e != null) {
            this.e.a = (zagu)var2;
         }

         return (zagu)var2;
      }
   }

   public zagu d(zaay var1) {
      zagu var2 = this.b.a;
      if (var2 == null) {
         var2 = this.n(var1);
      } else if (var2.h() != null && var2.h().a != null && var2.b(var1, false) != 3) {
         var2.h().a = null;
      }

      return var2;
   }

   private zagu a(zagu var1, zaay var2) {
      if (((zagu)var1).b() == 9 && !this.k() && ((Name)this.a).getSheetIndex() > 0) {
         zaye var3 = ((zaal)var1).k();
         zur var4 = var3.a();
         if (var4 != null && (var4.b & '\uffff') == 65534 && (var4.c & '\uffff') == 65534 && var2.p.g.v().a(var4.a & '\uffff').a() == 5) {
            var3 = new zaye(var3);
            int var5 = ((Name)this.a).getSheetIndex() - 1;
            var3.a(var2.a(var2.p.i, var5, var5));
            var1 = new zaal(this.d(), var3);
         }
      }

      return (zagu)var1;
   }

   private zaay m(zaay var1) {
      zaay var2 = new zaay(var1);
      if (!var2.i || var2.l.b()) {
         var2.i = true;
         if (var2.l.b() || var2.l.a()) {
            var2.l = CellArea.createCellArea(var1.g, var1.h, var1.g + 2, var1.h + 2);
         }
      }

      var2.f = this.a;
      var2.a = 1;
      return var2;
   }

   zagu l(zaay var1) {
      zagu var2 = this.b.a;
      return var2 != null ? var2 : (new zyg(var1, this.b.f, 0, -1, false)).a();
   }

   public boolean f(zaay var1) {
      return this.d(var1).f(var1);
   }

   public boolean g(zaay var1) {
      return this.d(var1).g(var1);
   }

   public boolean h(zaay var1) {
      return this.d(var1).h(var1);
   }

   public zagu a(int[] var1, zaay var2, boolean var3) {
      return this.d(var2).a(var1, var2, var3);
   }

   public zagu a(int[] var1, zaay var2) {
      return this.d(var2).a(var1, var2);
   }

   public zagu b(int[] var1, zaay var2) {
      return this.d(var2).b(var1, var2);
   }

   public zahn a(zaay var1, boolean var2) {
      var1 = this.m(var1);
      return this.d(var1).a(var1, var2);
   }

   private zagu n(zaay var1) {
      if (this.b.a != null) {
         return this.b.a;
      } else {
         Object var2;
         if (this.c > 0) {
            if (this.b.a()) {
               if (((zuk)this.a).a().a() != 0) {
                  var2 = zzf.a;
               } else {
                  var2 = zzc.a;
               }
            } else {
               byte[] var3 = this.b.f;
               int var4 = var1.p.j ? 2 : 4;
               zaye var5;
               byte var6;
               switch(var3[var4]) {
               case 28:
                  var2 = zyz.a(var3[var4 + 1]);
                  break;
               case 58:
               case 90:
               case 122:
                  var5 = new zaye();
                  var5.a(var1.a(var1.p.g.q().b(this.c - 1).a & '\uffff', com.aspose.cells.b.a.zc.e(var3, var4 + 1) & '\uffff', com.aspose.cells.b.a.zc.e(var3, var4 + 3) & '\uffff'));
                  var5.a(com.aspose.cells.b.a.zc.e(var3, var4 + 5));
                  var5.b(com.aspose.cells.b.a.zc.e(var3, var4 + 7) & '\uffff' & 16383);
                  var6 = var3[var4 + 8];
                  var5.a((var6 & 255 & 128) == 0);
                  var5.b((var6 & 255 & 64) == 0);
                  var5.t();
                  var2 = new zaal(zaaq.a(var3[var4]), var5);
                  break;
               case 59:
               case 91:
               case 123:
                  var5 = new zaye();
                  var5.a(var1.a(var1.p.g.q().b(this.c - 1).a & '\uffff', com.aspose.cells.b.a.zc.e(var3, var4 + 1) & '\uffff', com.aspose.cells.b.a.zc.e(var3, var4 + 3) & '\uffff'));
                  var5.a(com.aspose.cells.b.a.zc.e(var3, var4 + 5));
                  var5.c(com.aspose.cells.b.a.zc.e(var3, var4 + 7));
                  var5.b(com.aspose.cells.b.a.zc.e(var3, var4 + 9) & '\uffff' & 16383);
                  var5.d(com.aspose.cells.b.a.zc.e(var3, var4 + 11) & '\uffff' & 16383);
                  var6 = var3[var4 + 10];
                  var5.a((var6 & 255 & 128) == 0);
                  var5.b((var6 & 255 & 64) == 0);
                  var6 = var3[var4 + 12];
                  var5.c((var6 & 255 & 128) == 0);
                  var5.d((var6 & 255 & 64) == 0);
                  var2 = new zaal(zaaq.a(var3[var4]), var5);
                  break;
               case 60:
               case 61:
               case 92:
               case 93:
               case 124:
               case 125:
                  var2 = zzf.a;
                  break;
               default:
                  var2 = zzc.a;
               }
            }
         } else if (this.b.a()) {
            var2 = zzc.a;
         } else {
            var2 = (new zyg(this.m(var1), this.b.f, 0, -1, false)).a();
         }

         if (!this.b.c) {
            var2 = this.a((zagu)var2, var1);
            switch(((zagu)var2).b(var1, 32)) {
            case 0:
               if (this.b.b) {
                  var2 = zzc.a;
               } else {
                  var1.p.a(this.b);
                  var2 = this.a(((zagu)var2).d(var1), var1);
                  var1.p.d();
               }

               this.b.a = (zagu)var2;
               break;
            case 1:
               this.b.a = (zagu)var2;
               break;
            default:
               this.b.c = true;
            }
         }

         if (((zagu)var2).b() != 9) {
            ((zagu)var2).e();
         }

         return (zagu)var2;
      }
   }

   public int b(zaay var1, int var2) {
      if (this.b.b) {
         return 0;
      } else {
         var1.p.a(this.b);
         int var3 = this.l(var1).b(var1, var2);
         var1.p.d();
         return var3;
      }
   }

   public void a(StringBuilder var1, zaay var2) {
      if (this.c > 0) {
         zuk var3 = (zuk)this.a;
         switch(var3.a().a()) {
         case 0:
            if (var2 != null) {
               zur var9 = var2.p.g.q().b(this.c - 1);
               zaan.a(var2, var9.a & '\uffff', var9.b & '\uffff', var9.c & '\uffff', var1);
            }

            var1.append('!');
            break;
         case 3:
            if (var2 != null && var2.p.i()) {
               var1.append('[');
               var1.append(var2.p.f(var2.p.g.q().c(this.c - 1)));
               var1.append(']');
            } else {
               String var4 = null;
               String var5 = null;
               String[] var6 = new String[]{var4};
               String[] var7 = new String[]{var5};
               var3.a().a(var6, var7);
               var4 = var6[0];
               var5 = var7[0];
               var1.append(var4);
               var1.append("|");
               var1.append(var5);
            }

            var1.append('!');
         }

         if (var2 != null && zaan.b(var3.e(), var2)) {
            var1.append('\'').append(var3.e()).append('\'');
         } else {
            var1.append(var3.e());
         }
      } else {
         Name var8 = (Name)this.a;
         if (var8.getSheetIndex() > 0) {
            int var10 = var8.getSheetIndex() - 1;
            if (var2 != null) {
               if (this.c < 0 || var2.n != var10) {
                  var1.append(var2.a(var2.p.g.get(var10).getName()));
                  var1.append('!');
               }
            } else {
               var1.append(var8.h().get(var10).getName());
               var1.append('!');
            }
         }

         var1.append(var8.getText());
      }

   }

   public boolean a(zagu var1) {
      if (var1.b() != 8) {
         return false;
      } else {
         zzj var2 = (zzj)var1;
         return this.a == var2.a;
      }
   }
}
